<?php



/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Gmap
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
 
 
 
class Gmap_Form_Members extends User_Form_Search
{
  
  public function init()
  {
    $this->addLocationFields();
    parent::init();
  }
  
  protected function addLocationFields()
  {
    $i = -2000005;
    
    $this->addElement('Text', 'gmaplocation', array(
      'label' => 'Location',
      'order' => $i++,
      'validators' => array(
       // new Radcodes_Lib_Validate_Location_Address(),
      ),
      'decorators' => array(
        'ViewHelper',
        array('Label', array('tag' => 'span')),
        array('HtmlTag', array('tag' => 'li'))
      ),
    ));    
    
    $unit = Engine_Api::_()->getApi('settings', 'core')->getSetting('gmap.distanceunit', Radcodes_Lib_Helper_Unit::UNIT_MILE);
    
    $distances = array('0'=>"");
    $distance_ranges = array(1,5,10,25,50,100,250,500,1000);
    foreach ($distance_ranges as $distance) {
      $distances[$distance] = "$distance $unit";
    }
    
    $this->addElement('Select', 'gmapdistance', array(
      'label' => 'Within Distance',
      'order' => $i++,
      'filters' => array(
        new Radcodes_Lib_Filter_Null()
      ),    
      'multiOptions' => $distances,
      'decorators' => array(
        'ViewHelper',
        array('Label', array('tag' => 'span')),
        array('HtmlTag', array('tag' => 'li'))
      ),
    ));
    
    $this->addElement('Heading', 'gmapseparator', array(
      //'label' => '------',
      'order' => $i++,
      'decorators' => array(
        'ViewHelper',
        array('Label', array('tag' => 'span')),
        array('HtmlTag', array('tag' => 'li', 'class' => 'browse-separator-wrapper'))
      ),
    ));    
    
  }
  
}